// 公司设置相关API
import request from '@/utils/request'

// 获取所有角色列表 page(页码)，pagesize(每页条数)
const getRoleListAPI = (params) => request.get('/sys/role', { params })

// 根据id查询企业
const getCompanyInfoAPI = (id) => request.get(`/company/${id}`)

// 根据ID删除角色
const deleteRoleAPI = (id) => request.delete(`/sys/role/${id}`)

// 根据ID更新角色
const editRoleAPI = (data) => request.put(`/sys/role/${data.id}`, data)

// 添加角色
const addRoleAPI = (data) => request.post('/sys/role', data)

// 根据ID获取角色详情
// const getRoleDetailsAPI = (id) => request.get(`/sys/role/${id}`)
const getRoleDetailsAPI = (id) => request.get('/sys/role/' + id)

// 给角色分配权限
const assignPermRoleAPI = (data) => request.put('/sys/role/assignPrem', data)

export {
  getRoleListAPI,
  getCompanyInfoAPI,
  deleteRoleAPI,
  editRoleAPI,
  addRoleAPI,
  getRoleDetailsAPI,
  assignPermRoleAPI
}
